﻿<!--
(c) Copyright Cory Plotts.
This source is subject to the Microsoft Public License (Ms-PL).
Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
All other rights reserved.
-->
<Window
	x:Class="Snoop.ErrorDialog"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	Title="Unhandled Exception Occurred - Snoop"
	Width="640"
	Height="480"
>
	<Grid Margin="10">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<TextBlock
			Style="{x:Null}"
			Grid.Row="0"
			FontSize="16"
			Text="An unhandled exception has occured on the user interface thread."
			TextWrapping="Wrap"
		/>
		<TextBlock
			Style="{x:Null}"
			Grid.Row="1"
			Margin="0,10,0,0"
			Text="Stack:"
		/>
		<TextBox
			Style="{x:Null}"
			Grid.Row="2"
			x:Name="_textBlockException"
			AcceptsReturn="True"
			TextWrapping="NoWrap"
			HorizontalScrollBarVisibility="Auto"
			VerticalScrollBarVisibility="Auto"
		/>

		<StackPanel Grid.Row="3" Margin="0,20,0,0">
			<TextBlock
				Style="{x:Null}"
				Text="Take a look at the above stack (you can resize this dialog). If you think the exception is related to an issue in Snoop (versus the application you are Snooping), we would be very grateful if you could copy the stack trace to the clipboard and paste it into an issue at either CodePlex or GitHub."
				TextWrapping="Wrap"
			/>
			<TextBlock
				Style="{x:Null}"
				Margin="0,10,0,0"
				Text="Note that you'll have to submit this issue under your user ID for either site. If you don't have a user ID, registering for one is easy."
				TextWrapping="Wrap"
			/>
		</StackPanel>
 
		<StackPanel Grid.Row="4" HorizontalAlignment="Center" Margin="0,10,0,0" Orientation="Horizontal">
			<Button
				x:Name="_buttonCopyToClipboard"
				Width="175"
				Height="32"
				Margin="0,0,15,0"
				Click="_buttonCopyToClipboard_Click"
			>
				<TextBlock Style="{x:Null}" Text="Copy Exception to Clipboard"/>
			</Button>
			<StackPanel Orientation="Vertical" Grid.Row="3">
				<TextBlock>
					<Hyperlink NavigateUri="http://snoopwpf.codeplex.com/WorkItem/Create?ProjectName=snoopwpf" RequestNavigate="Hyperlink_RequestNavigate">
						<TextBlock Style="{x:Null}" Text="Click Here to create an issue on CodePlex."/>
					</Hyperlink>
				</TextBlock>

				<TextBlock>
					<Hyperlink NavigateUri="https://github.com/cplotts/snoopwpf/issues/new" RequestNavigate="Hyperlink_RequestNavigate">
						<TextBlock Style="{x:Null}" Text="Click Here to create an issue on GitHub."/>
					</Hyperlink>
				</TextBlock>
			</StackPanel>
		</StackPanel>

		<StackPanel Grid.Row="5" HorizontalAlignment="Center" Margin="0,40,0,0" Orientation="Horizontal">
			<CheckBox
				x:Name="_checkBoxRemember"
				Grid.Row="5"
				VerticalAlignment="Center"
				Margin="0,0,10,0"
				ToolTipService.ShowDuration="30000"
			>
				<TextBlock Style="{x:Null}" Text="Remember This Option"/>
				<CheckBox.ToolTip>
					<TextBlock
						Style="{x:Null}"
						MaxWidth="300"
						TextWrapping="Wrap"
					>
						<TextBlock.Inlines>
							<Run Text="This checkbox will remember whether you want to mark the exception handled or not, in the case that there are many unhandled exceptions, so that the dialog does not keep coming up."/>
							<LineBreak/>
							<LineBreak/>
							<Run Text="Note that clicking this checkbox and choosing one of the close buttons, also, in essence, stops this dialog from ever coming up again ... even in the case of a different unhandled exception ... until you Snoop the application all over again."/>
						</TextBlock.Inlines>
					</TextBlock>
				</CheckBox.ToolTip>
			</CheckBox>
			<Button
				Width="200"
				Height="32"
				Margin="0,0,10,0"
				Click="CloseDoNotMarkHandled_Click"
			>
				<TextBlock Style="{x:Null}" Text="Close And Do Not Handle Exception"/>
				<Button.ToolTip>
					<TextBlock
						Style="{x:Null}"
						MaxWidth="300"
						Text="Choosing this button closes the dialog and lets the exception through, which often will end up crashing the application."
						TextWrapping="Wrap"
					/>
				</Button.ToolTip>
			</Button>
			<Button
				Width="200"
				Height="32"
				Click="CloseAndMarkHandled_Click"
			>
				<TextBlock Style="{x:Null}" Text="Close And Mark Exception Handled"/>
				<Button.ToolTip>
					<TextBlock
						MaxWidth="300"
						Style="{x:Null}"
						Text="Choosing this button closes the dialog and marks the exception as handled, which should not end up crashing the application."
						TextWrapping="Wrap"
					/>
				</Button.ToolTip>
			</Button>
		</StackPanel>
	</Grid>
</Window>
